<?php


namespace app\api\validate;


use think\Validate;

/**
 * 订单模块叫眼泪
 */
class OrderValidate extends Validate
{

    // 校验规则
    protected $rule = [
        'id' => 'require|number',
        'orderId' => 'require|alphaNum',
        'page' => 'require|number',
        'limit' => 'require|number|between:2,100',
        'resource' => 'require|number|between:0,3',
        'type' => 'require|number|between:1,3',
        'class' => 'require|number|between:1,2',
        'typeId' => 'number|between:1,3',
    ];
    // 报错提示信息
    protected $message = [
        'id.require' => '请输入Id',
        'id.number' => 'Id请输入整数',
        'orderId.require' => '请输入订单编号',
        'orderId.number' => '请输入正确的订单编号',
        'page.require' => '请输入page参数',
        'page.number' => 'limit参数为正整数',
        'limit.require' => '请输入limit参数',
        'limit.number' => 'limit参数为正整数',
        'limit.between' => 'limit参数范围为2-100',
        'resource.require' => '请输入resource参数',
        'resource.number' => 'resource参数为正整数',
        'resource.between' => 'resource参数范围为0-3',
        'type.require' => '请输入type参数',
        'type.number' => 'type参数为正整数',
        'type.between' => 'type参数范围为1-3',
        'typeId.number' => 'typeId参数为正整数',
        'typeId.between' => 'typeId参数范围为1-3',
    ];
    // 校验场景
    protected $scene = [
        'buy' => ['id'],
        'order' => ['orderId'],
        'list' => ['page', 'limit', 'resource'],
        'profit' => ['page', 'limit', 'typeId'],
        'shelves' => ['page', 'limit', 'type'],
        'sell' => ['orderId', 'type']
    ];

}